<?php

/**
 * Challenge Cup configuration file,
 * @author Luke Barratt 
 * @copyright Copyright (C) 2008 by Luke Barratt
 * @license http://www.gnu.org/copyleft/gpl.html
 */
 
defined('CC_VALID') or 
die('Direct Access to this location is not allowed.'); 

// MySQL Functions

$CC_HOSTNAME = "localhost";
$CC_USERNAME = "root";
$CC_PASSWORD = "toor";
$CC_DATABASE = "cc";

$CC_MYSQL_CONNECT = CC_MYSQL_CONNECT($CC_HOSTNAME, $CC_USERNAME, $CC_PASSWORD, $CC_DATABASE);

function CC_MYSQL_CONNECT($CC_HOSTNAME, $CC_USERNAME, $CC_PASSWORD, $CC_DATABASE) {
	mysql_connect("$CC_HOSTNAME", "$CC_USERNAME", "$CC_PASSWORD") or die(mysql_error());
	mysql_select_db($CC_DATABASE) or die(mysql_error());
}

function CC_FREE_RESULT($CC_MYSQL_RESULT) {
	mysql_free_result($CC_MYSQL_RESULT);
}

echo $CC_MYSQL_CONNECT;

// Global Variables

$CC_ERROR = '[CC:ERROR]';
$CC_TEMPLATE = 'default_blue';
$CC_SITEURL = 'http://localhost/cc';
$CC_ABSOLUTE = 'C:/xampp/htdocs/cc';
$CC_STATUS = '1';
$CC_OFFLINE = "This site is Offline for maintenance.<br /> Please check back again soon.";

// Core functions

function CC_MODLOADER($CC_ABSOLUTE) {
	include($CC_ABSOLUTE .'/includes/system/modloader.php');
}

function CC_MODULE_LOAD($CC_ABSOLUTE, $CC_MODULE) {
	if (file_exists($CC_ABSOLUTE ."/includes/system/{$CC_MODULE}.php")) 
	{
		include($CC_ABSOLUTE ."/includes/system/{$CC_MODULE}.php");
	} 
	else
	{
		echo "<div id=\"notice\">Module '{$CC_MODULE}' was not found.</div>";
	}
}

function CC_MENULINK($CC_MODULE, $CC_GAME_ID) {
	if ($CC_GAME_ID != "") {
		echo "index.php?mod=". $CC_MODULE ."&game_id=". $CC_GAME_ID;
	}
	else
	{
		echo "index.php?mod=". $CC_MODULE;
	}
}

function CC_GAMELIST($CC_ABSOLUTE) {
	include($CC_ABSOLUTE .'/includes/widgets/gamelist.php');
}

function CC_MININAV($CC_ABSOLUTE) {
	include($CC_ABSOLUTE .'/includes/widgets/mininav.php');
}

function CC_TITLE() {
	echo 'Challenge Cup';
}

// $CC_USERAREA = include($CC_ABSOLUTE .'/includes/widgets/userarea.php');

?>